﻿using StarsAdmin.Core.Enums;
using StarsAdmin.Core.Models;

namespace StarsAdmin.Core.DB.Entities
{
    /// <summary>
    /// 城市实体
    /// </summary>
    public class RegionEntity : BaseEntity, ITree<RegionEntity>
    {
        /// <summary>
        /// 编码
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 地区类型
        /// </summary>
        public RegionTypeEnum Type { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        public string? Description { get; set; }

        /// <summary>
        /// 上级Id
        /// </summary>
        public long? ParentId { get; set; }

        /// <summary>
        /// 上级
        /// </summary>
        public virtual RegionEntity Parent { get; set; }

        /// <summary>
        /// 下级列表
        /// </summary>
        public virtual ICollection<RegionEntity> Children { get; set; } = new List<RegionEntity>();
    }
}